-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: middleware #208
feat: middleware #208
Conversation
"github.com/golang-jwt/jwt/v4" | ||
"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/gateway/dao" | ||
"github.com/vesoft-inc/nebula-http-gateway/ccore/nebula/gateway/pool" | ||
"github.com/vesoft-inc/nebula-studio/server/api/studio/internal/config" | ||
"github.com/vesoft-inc/nebula-studio/server/api/studio/internal/types" | ||
"github.com/vesoft-inc/nebula-studio/server/api/studio/pkg/ecode" | ||
"github.com/vesoft-inc/nebula-studio/server/api/studio/pkg/utils" | ||
"github.com/zeromicro/go-zero/rest" | ||
"github.com/zeromicro/go-zero/rest/httpx" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import with sort? you can make check.
@@ -0,0 +1,100 @@ | |||
package middleware |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will publish the pkg.
defer server.Stop() | ||
|
||
// global middleware | ||
// server.Use(auth.AuthMiddleware) | ||
server.Use(auth.AuthMiddlewareWithConfig(&c)) | ||
|
||
// static assets handlers | ||
utils.RegisterHandlers(server, svcCtx, embedAssets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, utils.RegisterHandlers
is no longer needed, can it be deleted?
|
||
svcCtx := svc.NewServiceContext(c) | ||
server := rest.MustNewServer(c.RestConf, rest.WithNotFoundHandler(middleware.NewAssertsHandler(middleware.AssertsConfig{ | ||
Root: "assets", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you configure the Filesystem
, the Root
is need not.
@@ -6,6 +6,6 @@ Debug: | |||
Enable: false | |||
Auth: | |||
AccessSecret: "login_secret" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a more strict random string?
return &types.ConnectDBResult{ | ||
Version: string(clientInfo.NebulaVersion), | ||
Version: string(request.NebulaVersion), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so where you real make the db connection? logics seems to be delete above?
Value: clientInfo.ClientID, | ||
Path: "/", | ||
HttpOnly: true, | ||
MaxAge: 1800, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read from the config? just make it configurable
MaxAge: 1800, | ||
} | ||
nsid := http.Cookie{ | ||
Name: "nsid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to make the nsid conflict with other apps, you'd better make it configuarable and add a prefix like explorer-nsid
. So same is the cookie field token
w.Header().Set("Set-Cookie", token.String()) | ||
w.Header().Add("Set-Cookie", nsid.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these fileds http-only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* feat: middleware * feat: dynamicly add query params func * feat: common params * update: go mod tidy * feat: batchExec
feat: mime && connectdb store u 文件上传、删除、预览功能实现 (#206) feat: middleware (#208) * feat: middleware * feat: dynamicly add query params func * feat: common params * update: go mod tidy * feat: batchExec complete file and import task (#213) modify upload and download mody: go mod refine the code update: make check modify return values Refactor (#219) * update: server-v2 * updata: format feat: context auth (#220) update: export module (#222) feat: export RegisterHandlers (#223) update: gitignore (#224) fix: fix service init crash (#225) update: WithErrorMessage (#226) fix import task (#227) fix the type conveersion problem fix: fix import & file model (#229)
feat: mime && connectdb feat: 文件上传、删除、预览功能实现 (#206) feat: middleware (#208) * feat: middleware * feat: dynamicly add query params func * feat: common params * update: go mod tidy * feat: batchExec complete file and import task (#213) modify upload and download mody: go mod refine the code update: make check modify return values Refactor (#219) * update: server-v2 * updata: format feat: context auth (#220) update: export module (#222) feat: export RegisterHandlers (#223) update: gitignore (#224) fix: fix service init crash (#225) update: WithErrorMessage (#226) fix import task (#227) fix the type conveersion problem fix: fix import & file model (#229) Co-authored-by: Bruce <[email protected]>
* feat: middleware * feat: dynamicly add query params func * feat: common params * update: go mod tidy * feat: batchExec
No description provided.